- address_type = type.to_s.camelize
- address_attr = "#{type}_address"
- address = get_address(asset, address_attr)

- same_as_billing ||= false

= f.fields_for(address_attr.to_sym) do |a|
  = a.hidden_field :address_type, value: address_type
  - unless Setting.compound_address
    - if same_as_billing
      %div
        %span(style="float:right")
          = link_to_function(t(:same_as_billing), "crm.copy_address('account_shipping_address', 'account_billing_address')")
        .label #{t title}:
    - else
      .label #{t title}:
    = a.text_area :full_address, style: "width:240px", rows: 4
  - else
    %table.address(cellpadding="0" cellspacing="0")
      %tr
        %td
          - if same_as_billing
            %div
              %span(style="float:right")
                = link_to_function(t(:same_as_billing), "crm.copy_compound_address('account_billing_address', 'account_shipping_address')")
              .label #{t title}:
          - else
            .label #{t title}:
          = address_field(a, :street1, "width:240px; margin-top:3px")
          = address_field(a, :street2, "width:240px;")
    %table.address(cellpadding="0" cellspacing="0")
      %tr
        %td
          = address_field(a, :city, "width:165px;")
        %td= spacer
        %td
          = address_field(a, :state, "width:60px;")
    %table.address(cellpadding="0" cellspacing="0")
      %tr
        %td
          = address_field(a, :zipcode, "width:80px;")
        %td= spacer
        %td
          = a.country_select(:country, {priority_countries: priority_countries, include_blank: true}, {data: { placeholder: t(:select_a_country)}, class: 'select2'})